package com.heihei.authority.core.validate.code;


import java.time.LocalDateTime;


public class ValidateCode {

	private String code;

	private LocalDateTime expireTime;

	/**
	 * 判断时间是否过期
	 *
	 * @param
	 * @Return {@link boolean}
	 * @throws
	 * @author duanhengfei
	 * @date 2021年04月04日 22:42:35
	 */
	public boolean isExpired() {
		return LocalDateTime.now().isAfter(expireTime);
	}

	public ValidateCode(String code, long expireIn) {
		this.code = code;
		this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
	}

	public ValidateCode(String code, LocalDateTime expireTime) {
		this.code = code;
		this.expireTime = expireTime;
	}

	public ValidateCode() {
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public LocalDateTime getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(LocalDateTime expireTime) {
		this.expireTime = expireTime;
	}
}
